﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace WinFormTest
{
	public partial class GetTime : Form
	{
		public GetTime()
		{
			InitializeComponent();
		}

		private void GetTime_Load(object sender, EventArgs e)
		{
			Thread thread = new Thread(() => 
			{
				while (true)
				{
					this.Invoke((MethodInvoker)delegate()
					{
						this.Refresh();
						Graphics gra = CreateGraphics();
						gra.DrawString("当前时间："+DateTime.Now.ToString("yyyy年MM月dd日 HH时mm分ss秒fff"),
							new Font("宋体",15),Brushes.Blue,new Point(10,10));
					});
					Thread.Sleep(100);
				}
			});
			thread.IsBackground = true;
			thread.Start();
		}
		
	}
}
